Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Fixed multiple OnScreenStick Components that does not work together when using them simultaneously in isolation mode (ISXB-813) #2090

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

bmalrat
Copy link
Collaborator

@bmalrat bmalrat commented Dec 16, 2024

Description

When multiple OnScreenStick is used at the same time, in isolation mode, it doesn't distinguish which finger drive the components and will be not functional.

To fix that I added, when it come from a touch event a track of which finger triggered it and only use information from it.
I also switched the pointerdown tracking to bypass to be able to track any pointer down/up instead of only the First down and last Up.

Testing status & QA

Added tests
tested on android with the customer project.

Overall Product Risks

Please rate the potential complexity and halo effect from low to high for the reviewers. Note down potential risks to specific Editor branches if any.

  • Complexity:
  • Halo Effect:

Comments to reviewers

Please describe any additional information such as what to focus on, or historical info for the reviewers.

Checklist

Before review:

  • [X ] Changelog entry added.
    • Explains the change in Changed, Fixed, Added sections.
    • For API change contains an example snippet and/or migration example.
    • JIRA ticket linked, example (case %%). If it is a private issue, just add the case ID without a link.
    • Jira port for the next release set as "Resolved".
  • [ X] Tests added/changed, if applicable.
    • Functional tests Area_CanDoX, Area_CanDoX_EvenIfYIsTheCase, Area_WhenIDoX_AndYHappens_ThisIsTheResult.
    • Performance tests.
    • Integration tests.
  • Docs for new/changed API's.
    • Xmldoc cross references are set correctly.
    • Added explanation how the API works.
    • Usage code examples added.
    • The manual is updated, if needed.

During merge:

  • Commit message for squash-merge is prefixed with one of the list:
    • NEW: ___.
    • FIX: ___.
    • DOCS: ___.
    • CHANGE: ___.
    • RELEASE: 1.1.0-preview.3.

After merge:

  • Create forward/backward port if needed. If you are blocked from creating a forward port now please add a task to ISX-1444.

… when using them simultaneously in isolation mode.
@bmalrat bmalrat requested review from Pauliusd01 and ekcoh December 16, 2024 20:28
Debug.Assert(EventSystem.current != null);

var screenPosition = Vector2.zero;
if (ctx.control?.device is Pointer pointer)
TouchControl touchControl = null;
if (ctx.control?.parent is TouchControl touch)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this is the design, generally this is a perfect fit for a device-agnostic pointer interface (just a side note)


var screenPosition = ((Pointer)ctx.control.device).position.ReadValue();
// If it's a finger take the value from the finger that initiated the change
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More a general conceptual thought around the scalability of this than the particular fix, what if the on screen control is interacted with a pen?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good question I don't have a pen/touch setup to test.
But we can fix the pen case after if needed. Here it only fix when it comes from a touch device

@@ -430,6 +481,10 @@ public bool useIsolatedInputActions
private List<RaycastResult> m_RaycastResults;
[NonSerialized]
private PointerEventData m_PointerEventData;
[NonSerialized]
private TouchControl m_TouchControl;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really related to this fix, but more to the original design, this implies that a member would need to be added for any kind of pointer device right? Or is this particularly due to TouchControl not being a derivative of pointer in your opinion @bmalrat ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally we don't need it for each type, only for touch to identify which one was touched in the /touch*/press. I'm not aware of an other type that could aggregate multiple source into one binding.

Copy link
Collaborator

@Pauliusd01 Pauliusd01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked touch controls using the user project as well as the standard touch control project we use for release testing, did not notice any issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants